package com.yyt.libsrc.router;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.launcher.ARouter;
import com.yyt.libsrc.R;


public class RouterHelper {
    private static RouterHelper instance;

    private RouterHelper() {

    }

    public static RouterHelper getInstance() {
        synchronized (RouterHelper.class) {
            if (instance==null) {
                instance = new RouterHelper();
            }
        }
        return instance;
    }

    public void startAct(String path) {
        Postcard build = ARouter.getInstance().build(path);
        build.navigation();
    }

    public void startAct(String path, int flag) {
        Postcard build = ARouter.getInstance().build(path);
        build.withFlags(flag);
        build.navigation();
    }

    public void startAct(String path, Bundle bundle) {
        ARouter.getInstance().build(path).with(bundle)
                .navigation();
    }

    public void startActForResult(String path, Activity activity, int reqCode) {
        ARouter.getInstance().build(path).navigation(activity,reqCode);
    }
}
